package com.six.JacksonOperation;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.six.entity.Person;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * ClassName:JsonToJava
 * Package:com.six
 * Description
 *
 * @Author:@wenxueshi
 * @Create:2023/7/27 - 22:48
 * @Version:v1.0
 */
//JSON字符串-->Map
public class JsonToJava7 {

    public static void main(String[] args) throws IOException {
        String json = "{\"name\":\"swx\",\"age\":18,\"skillsList\":[\"java\",\"python\",\"php\"]}";
        ObjectMapper objectMapper = new ObjectMapper();
        Map<String, Object> objectMap = objectMapper.readValue(json, new TypeReference<Map<String, Object>>() {
        });
        //{name=swx, age=18, skillsList=[java, python, php]}
        System.out.println(objectMap);
    }
}
